home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 36
/
PC Gamer IT CD 36 2-2.iso
/
VIGDEMO
/
data1.cab
/
Assets
/
scripts
/
manticore.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
5KB
|
744 lines
int Initialize(string type)
{
global int state = 0;
global real repeatTime = 1.00;
global string gProjType = "rocketmanticore";
global int gGravity = 0;
global int gBulletCount = 300;
global int gBulletPerShot = 6;
global int gClipSize = 5;
global int gLaunchCount = 0;
global real gTimeBetweenShots = 0.2;
global int gStartSound = 7;
global int gProgressSound = 18;
global int gEndSound = 27;
global int gReloadSound = -1;
global int gPrivileged;
global real gMass = 3.0;
Reset("dummy");
return 0;
}
int Reset(string dummy)
{
Animate(thisObject,0,"fire");
wakeupTime = -1.0;
gPrivileged = 0;
SetStyle(thisObject,2);
gBulletCount = gClipSize;
state = 0;
return 0;
}
int SetBulletCount(int count)
{
gBulletCount = count;
}
int startsound(string soundname)
{
gStartSound = GetSoundIndex(soundname);
}
int endsound(string soundname)
{
gEndSound = GetSoundIndex(soundname);
}
int progresssound(string soundname)
{
gProgressSound = GetSoundIndex(soundname);
}
int reloadsound(string soundname)
{
gReloadSound = GetSoundIndex(soundname);
}
int projtype(string str)
{
gProjType = str;
}
int repeattime(string str)
{
repeatTime = Str2Real(str);
return 0;
}
int gravity(string flag)
{
int value;
value = Str2Int(flag);
gGravity = value;
SetCollidableProperties(thisObject,gGravity,0);
}
int clipsize(string count)
{
gClipSize = Str2Int(count);
gBulletCount = gClipSize;
}
int GetMaxAmmo(string dummy)
{
ReturnValue(thisObject, gClipSize);
}
int addammo(string count)
{
int value = Str2Int(count);
gBulletCount = gBulletCount + value;
}
int reload(string count)
{
int add;
add = Str2Int(count);
if (add > 0)
{
PlaySound(thisObject,gReloadSound);
gBulletCount += add;
}
}
int AmmoCount(string dum)
{
ReturnValue(thisObject,gBulletCount);
}
int Drop(string dummy)
{
int returnBullet;
SetScale(thisObject,2.0);
PlaySound(thisObject,38);
SetStyle(thisObject,2);
ReturnValue(thisObject,0);
}
int Draw(string ammoCount)
{
gBulletCount = Str2Int(ammoCount);
}
int Pickup(string dummy)
{
gPrivileged = 0;
ReturnValue(thisObject,gBulletCount);
gBulletCount = 0;
}
int Holster(string dummy)
{
ReturnValue(thisObject,gBulletCount);
gBulletCount = 0;
}
int Colliders(string dummy)
{
map::iterator ix;
map objInList;
int value;
objInList = Collisions(thisObject,0,1,0);
for (ix = begin(objInList) ;ix != end(objInList); ++ix)
{
value = AddObjectTo(first(dereference(ix)),thisObject);
if (value != 0)
{
PlaySound(thisObject,35);
SetScale(thisObject,1.0);
break;
}
}
return 0;
}
int GetFireTime(string dummy)
{
ReturnValueReal(thisObject,repeatTime);
return 0;
}
int Fire(int flag)
{
real time ;
int theGrenade;
real x;
real y;
real z;
real speedoffset;
int result = 0;
int i;
time = GetTime(thisObject);
if (UnlimitedAmmo(thisObject) == 1)
gBulletCount = gClipSize;
if (state == 0)
{
gLaunchCount = 0;
if (gBulletCount >= 1)
{
gPrivileged = 1;
FireSaveInfo(thisObject,1,gBulletCount,gMass);
FireCommand(thisObject);
wakeupTime = time + repeatTime;
result = 1;
}
else
{
ParentReloadCommand(thisObject);
}
}
ReturnValue(thisObject,result);
return result;
}
int FireFulfill(int hit)
{
real time;
time = GetTime(thisObject);
state = 2;
Animate(thisObject,1,"fire");
LaunchMissile(0);
ParentFire(thisObject);
wakeupTime = time + repeatTime;
}
int FireRocket(real x, real y, real z,int muzzle,int trail)
{
int theGrenade;
theGrenade = MakeProjectile(thisObject,gProjType);
if (theGrenade != 0)
{
Launch(thisObject,theGrenade,trail,20.0,y,x,z,0);
if (muzzle == 0)
LaunchEFX(thisObject,0,0);
}
}
int LaunchMissile(int input)
{
int theGrenade;
real x;
real y;
real z;
x = 0.0;
y = 3.0;
gBulletCount -= gBulletPerShot;
z = 1.1;
x = -1.1;
FireRocket(x,y,z,1,0);
z = 0.0;
x = -1.1;
FireRocket(x,y,z,0,1);
z = -1.1;
x = -1.1;
FireRocket(x,y,z,0,0);
z = 1.1;
x = 1.1;
FireRocket(x,y,z,0,1);
z = 0.0;
x = 1.1;
FireRocket(x,y,z,0,0);
z = -1.1;
x = 1.1;
FireRocket(x,y,z,0,1);
gLaunchCount = 6;
}
int TimedEvent(int input)
{
real time;
time = GetTime(thisObject);
Animate(thisObject,0,"fire");
state = 0;
wakeupTime = -1.0;
return 0;
}